﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Web.Caching;
using System.Web;

namespace BuXiaChu.OrderDishes.BLL.Constants
{
    public class CodeDictionaryConstants
    {
        /// <summary>
        /// 餐厅类别
        /// </summary>
        public static readonly int RestaurantCatID = 4;
        /// <summary>
        /// 菜品计量单位
        /// </summary>
        public static readonly int DishesUnit = 5;
        /// <summary>
        /// 订单状态
        /// </summary>
        public static readonly int OrderStatus = 3;
        /// <summary>
        /// 员工职称
        /// </summary>
        public static readonly int JobTitle = 6;
        /// <summary>
        /// 性别
        /// </summary>
        public static readonly int Gender = 7;
        /// <summary>
        /// 服务站级别
        /// </summary>
        public static readonly int ServiceStationLevel = 8;
        /// <summary>
        /// 公告级别
        /// </summary>
        public static readonly int NoticeLevel = 9;
        /// <summary>
        /// 送餐员
        /// </summary>
        public static readonly int DeliveryGuys = 24;
        /// <summary>
        /// 接线员
        /// </summary>
        public static readonly int Operator = 26;

        static CodeDictionaryConstants()
        {
            try
            {
                #region
                var file = HttpContext.Current.Server.MapPath(@"~\Config\CodeDictionaryConstants.config");
                RestaurantCatID = 3;
                XmlDocument doc = new XmlDocument();
                doc.Load(file);
                var node = doc.DocumentElement.SelectSingleNode("RestaurantCatID");
                if (node != null)
                {
                    RestaurantCatID = int.Parse(node.InnerText);
                }
                node = doc.DocumentElement.SelectSingleNode("DishesUnit");
                if (node != null)
                {
                    DishesUnit = int.Parse(node.InnerText);
                }
                node = doc.DocumentElement.SelectSingleNode("OrderStatus");
                if (node != null)
                {
                    OrderStatus = int.Parse(node.InnerText);
                }
                node = doc.DocumentElement.SelectSingleNode("JobTitle");
                if (node != null)
                {
                    JobTitle = int.Parse(node.InnerText);
                }
                node = doc.DocumentElement.SelectSingleNode("Gender");
                if (node != null)
                {
                    Gender = int.Parse(node.InnerText);
                }
                node = doc.DocumentElement.SelectSingleNode("ServiceStationLevel");
                if (node != null)
                {
                    ServiceStationLevel = int.Parse(node.InnerText);
                }

                node = doc.DocumentElement.SelectSingleNode("NoticeLevel");
                if (node != null)
                {
                    NoticeLevel = int.Parse(node.InnerText);
                }
                #endregion
            }
            catch (Exception ex)
            { }
        }
    }
}
